<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>首页</title>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="../../../css/bootstrap.min.css">
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="../../../js/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="../../../js/bootstrap.min.js"></script>
</head>

<body>

<form action="" class="form-horizontal">
 	<div class="row">
    	<div class="col-xs-9 ">
          <input type="button"   class="btn btn-success"    value="添加权限信息" id="add_btn" />
         	 <input  type="button" id="update_btn" class="btn btn-info" value="修改权限信息"/>
        	<input  type="button" class="btn btn-danger" id="delete_btn" value="删除权限信息"/>
          
        </div>
    </div>
    <h5 class="page-header alert-info" style="padding:10px; margin:0px; margin-bottom:5px;">基本信息</h5>
	<div class="row">
    	<div class="col-xs-5">
        	<div class="form-group">
            	<label class="col-xs-3 control-label">权限编号</label>
                <div class="col-xs-9">
                	<p class="form-control-static" id="aid">1001</p>
                </div>
            </div>
        
        </div>
        <div class="col-xs-5">
            <div class="form-group">
            	<label class="col-xs-3 control-label">权限名称</label>
                <div class="col-xs-9">
                		<p class="form-control-static" id="aname">程序员</p>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
    	<div class="col-xs-5">
        	<div class="form-group">
            	<label class="col-xs-3 control-label">上级权限</label>
                <div class="col-xs-9">
                	<p class="form-control-static" id="parent">系统管理</p>
                </div>
            </div>
        
        </div>
        <div class="col-xs-5">
            <div class="form-group">
            	<label class="col-xs-3 control-label">权限URL</label>
                <div class="col-xs-9">
                	<p class="form-control-static" id="aurl">system/list.do</p>
                </div>
            </div>
        </div>
    </div>
    <h5 class="page-header alert-info" style="padding:10px; margin:0px; margin-bottom:5px;">备注信息</h5>
    	<div class="row">
    	<div class="col-xs-10">
        	<div class="form-group">
            	<label class="col-xs-3 control-label">备注</label>
                <div class="col-xs-9">
                	<p class="form-control-static" id="adesc">查询用户信息</p>
                </div>
            </div>
        
        </div>

    </div>


</form>

<script type="text/javascript">

    $(function () {
        if(parent.select_tree_anthorty){
            initAnthorty(parent.select_tree_anthorty);
        }
    })

    var selectOBJ ;
    function  initAnthorty(anthorty) {
        if(anthorty.children.length>0){
            $("#delete_btn").attr("disabled",true)
        }else{
            $("#delete_btn").attr("disabled",false)
        }
        $("#aid").html(anthorty.anthortyId)
        $("#aname").html(anthorty.title)
        $("#aurl").html(anthorty.anthortyUrl)
        $("#adesc").html(anthorty.anthortyDesc)
        $.post("AnthortyInfoServlet.do?m=byid",{anthortyId:anthorty.anthortyPid},function (data) {
            $("#parent").html(data.title)
            anthorty.anthorty_parent = data; //为对象添加parent属性,设置当前查询出来的父节点对象
            selectOBJ = anthorty;
        },"json")
    }
    
    $("#update_btn").click(function () {
        location.href="anthorty_add.html";
        parent.update_anthorty =selectOBJ;
    })
    $("#add_btn").click(function () {
        location.href="anthorty_add.html";
        parent.update_anthorty =undefined;
    })
    $("#delete_btn").click(function () {
        $.post("AnthortyInfoServlet.do?m=delete&anthortyId="+selectOBJ.anthortyId,function (data) {
            if(data == "true"){
                alert("删除成功!")
                parent.flushTree6(selectOBJ.anthortyPid);
            }
        })
    })
</script>

</body>
</html>
